Repository navigation
Generate code for OpenAPI 3.2 query/additionalOperations/in:querystring - #24982
khayashi4337 wants to merge 64 commits into
Conversation
…perations (OpenAPITools#24212) Under --skip-validate-spec, when the parser encounters a path-item member it doesn't recognize (e.g. a future operation like OpenAPI 3.2's 'query' HTTP method), it silently drops it and generation reports success with no indication that an operation is missing. - Detect swagger-parser's "attribute paths.'X'.Y is unexpected" messages and escalate matching ones into an explicit WARN naming exactly which path-item members will be missing from the generated output. - When the parser cannot produce an OpenAPI object at all (e.g. an unsupported spec version), fail immediately with a message that includes the parser's own diagnostics, instead of letting null propagate through several layers before a generic error surfaces later in DefaultGenerator.generate(). Closes OpenAPITools#24212
…erystring - ingest PathItem.query and PathItem.additionalOperations through the same core paths as the fixed methods (operation collection, preprocess, callback discovery, inline model resolution, filter marking, PathItem serialization); additionalOperations keys are sent verbatim as the HTTP method name - represent `in: querystring` parameters as a plain string via the new CodegenParameter.isQueryStringParam flag; generators without dedicated support are warned once - okhttp-gson: serialize querystring params as the whole already-encoded query string appended to the path, register query/additional operations in dynamicOperations lookup (only when the spec uses them, so generated clients still compile against the pinned swagger-parser), and accept querystring in fillParametersFromOperation - bump swagger-parser to 2.1.49-SNAPSHOT for OpenAPI 3.2 model classes
Generators whose templates embed enumerated HTTP method constants
(e.g. HttpMethod.QUERY) produced uncompilable code for OpenAPI 3.2
query/additionalOperations. Introduce supportsAdditionalOperations()
(default false; only okhttp-gson opts in) so unsupported generators
warn and skip instead.
- CodegenConfig: supportsAdditionalOperations() capability hook
- DefaultGenerator/DefaultCodegen/InlineModelResolver: skip 3.2
query/additionalOperations with a warning when unsupported
- JavaClientCodegen: enable the capability for okhttp-gson only
- fromCallback: keep additionalOperations method names verbatim
("customMethod" no longer becomes CUSTOMMETHOD) and warn on skip
- MergedSpecBuilder: merge additionalOperations and cover them in
operationId conflict detection instead of dropping them
- ApiClient.mustache: put section tags on their own lines so
generated indentation is stable in both branches
- regenerate okhttp-gson-dynamicOperations sample
…ystring Opt the Go client generator into the 3.2 capability gates and emit operations that actually compile and behave correctly on the wire: - supportsAdditionalOperations()/supportsQueryStringParameters() return true for the go client generator only - Non-standard HTTP methods are snapshotted verbatim before AbstractGoCodegen camelizes httpMethod (which would corrupt "customMethod" into "Custommethod"), then restored and flagged with x-go-http-method-literal. IdentityHashMap is required because CodegenOperation.hashCode() includes the mutating httpMethod field. The same snapshot/restore is applied to webhooks via postProcessWebhooksWithModels, which renders through api.mustache too. - api.mustache emits standard methods as http.MethodXxx constants and non-standard methods as unescaped string literals so valid HTTP token punctuation (e.g. CHECK&FETCH) survives intact - in:querystring parameters append their raw, already-encoded value to the request path instead of name=value serialization - client.mustache captures url.RawQuery before url.Query() merges it into the normal parameter map, then re-appends it verbatim. Note: for requests whose path already embeds a query string, the embedded pairs now keep their verbatim form/order instead of being merged, decoded and re-sorted by Encode(); the only producer of such paths is the 3.2 querystring parameter (it cannot coexist with in:query per spec validation) - "strings" import is added when a querystring parameter exists and deduplicated against the path-parameter import Verified: go build on generated client, httptest request-capture tests (QUERY method, verbatim customMethod and CHECK&FETCH casing, verbatim raw query, ordinary GET regression, pathParam+querystring on one op), go-gin-server warns and omits unsupported 3.2 operations. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Python (urllib3 library only): - flag non-standard HTTP methods and querystring params after postProcessOperationsWithModels/WebhooksWithModels - emit non-standard methods via unescaped literals; append in: querystring values verbatim to the request path - bypass urllib3's request() for non-standard methods (it unconditionally uppercases); dispatch via request_encode_url/request_encode_body - fix double '?' when querystring path combines with serialized query params (e.g. apiKey-in-query auth) - validate additionalOperations keys as RFC 9110 tokens at codegen time; warn and skip invalid ones - asyncio(aiohttp)/httpx stay unsupported (they uppercase internally) and warn+skip 3.2 operations Go: same RFC 9110 token validation for verbatim method literals. Generated clients verified by request capture: QUERY/customMethod/ CHECK&FETCH sent verbatim, querystring preserved as written, standard GET unchanged. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ns and in:querystring
- enable supportsAdditionalOperations/supportsQueryStringParameters:
fetch() passes RequestInit.method verbatim, preserving arbitrary
method names
- emit non-standard methods as double-quoted unescaped literals
(apostrophes and backticks are valid tchars); warn+skip keys that
are not RFC 9110 tokens, warn when fetch forbids the method
- widen HTTPMethod with (string & {}) so custom methods typecheck
while keeping autocomplete for the standard set
- append in:querystring values verbatim to urlPath ('&' when a '?'
is already present); match that in createFetchParams so
apiKey-in-query auth params chain with '&' instead of a second '?'
- escape '|' in generated markdown docs via x-ts-http-method-doc
- fix ExtendedCodegenParameter's manual field copy silently dropping
~30 CodegenParameter fields (isQueryStringParam among them); copy
every field/accessor now
- webhooks get the same flags via postProcessWebhooksWithModels
Verified by tsc strict compile and a raw-TCP capture test: QUERY,
customMethod and CHECK&FETCH reach the wire verbatim, the querystring
value is preserved as written, standard GET unchanged. typescript-axios
and other siblings warn and skip 3.2 operations as before.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…erystring Enable OpenAPI 3.2 constructs for the rust client generator, reqwest library only (hyper/hyper0x/reqwest-trait keep warning and skipping unsupported operations): - supportsAdditionalOperations()/supportsQueryStringParameters() return true for the reqwest library - Non-standard HTTP methods (query op, additionalOperations) are snapshotted before the per-library method-case conversion and emitted verbatim via reqwest::Method::from_bytes(b"..."), preserving case (e.g. customMethod) and RFC 9110 tchar punctuation (e.g. CHECK&FETCH) - Invalid RFC 9110 method tokens are warned about and skipped instead of producing uncompilable Rust - `in: querystring` parameters append the caller-supplied query component verbatim to the URI (with ? or & as needed), bypassing reqwest's name=value .query() serialization; excluded from the queryParams template loop - Webhook operations get the same verbatim-method and querystring handling via postProcessWebhooksWithModels - Doc templates escape | in method names so markdown tables stay intact - New TestNG coverage includes a committed wire-level test: the generated blocking client is built with cargo and its request lines are captured on a raw TCP listener, verifying QUERY, customMethod, CHECK&FETCH, PURGE and a verbatim, non-double-encoded querystring (skipped when cargo or crates.io is unavailable) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
3 issues found across 98 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java:1435">
P1: This enables 3.2 webhook operations, but dynamic webhook methods cannot resolve them because the okhttp-gson lookup map contains paths only. With `dynamicOperations=true`, those webhook calls throw `ApiException("Operation not found in OAS")`; register webhook operations in the lookup map or guard this support for dynamic webhook generation.</violation>
</file>
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java:747">
P1: `existing.addAdditionalOperation` merges custom operations without the source spec's root-level security. Extend `propagateRootSecurityToOperations` to cover `additionalOperations` before merging, or these generated methods lose their authentication requirements.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache:1918">
P1: Dynamic clients generated for 3.2 specs will not compile because this branch calls parser methods absent from the generated client's pinned `swagger-parser-v3:2.0.30`. Update the generated build dependencies to a parser release containing the OpenAPI 3.2 `PathItem` methods before emitting these calls.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| protected boolean supportsQueryStringParameters() { | ||
| // only the okhttp-gson api.mustache serializes an `in: querystring` | ||
| // parameter as the whole (already-encoded) query string | ||
| return isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary()); |
There was a problem hiding this comment.
P1: This enables 3.2 webhook operations, but dynamic webhook methods cannot resolve them because the okhttp-gson lookup map contains paths only. With dynamicOperations=true, those webhook calls throw ApiException("Operation not found in OAS"); register webhook operations in the lookup map or guard this support for dynamic webhook generation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java, line 1435:
<comment>This enables 3.2 webhook operations, but dynamic webhook methods cannot resolve them because the okhttp-gson lookup map contains paths only. With `dynamicOperations=true`, those webhook calls throw `ApiException("Operation not found in OAS")`; register webhook operations in the lookup map or guard this support for dynamic webhook generation.</comment>
<file context>
@@ -1426,4 +1427,31 @@ protected void applyJspecify() {
+ protected boolean supportsQueryStringParameters() {
+ // only the okhttp-gson api.mustache serializes an `in: querystring`
+ // parameter as the whole (already-encoded) query string
+ return isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary());
+ }
+
</file context>
There was a problem hiding this comment.
Not addressed in this PR, intentionally. The okhttp-gson dynamicOperations lookup map (ApiClient.mustache createOperationLookupMap) has only ever been built from openAPI.getPaths(), so webhooks were never reachable through it, before or after this PR. Adding webhook support to dynamic operations is a separate feature. I added a comment documenting this limitation in 2ea2e94 and would prefer to handle it in a follow-up PR rather than grow this one.
| // WARN: keep the first (existing) operation, skip the incoming one. | ||
| return; | ||
| } | ||
| existing.addAdditionalOperation(method, operation); |
There was a problem hiding this comment.
P1: existing.addAdditionalOperation merges custom operations without the source spec's root-level security. Extend propagateRootSecurityToOperations to cover additionalOperations before merging, or these generated methods lose their authentication requirements.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java, line 747:
<comment>`existing.addAdditionalOperation` merges custom operations without the source spec's root-level security. Extend `propagateRootSecurityToOperations` to cover `additionalOperations` before merging, or these generated methods lose their authentication requirements.</comment>
<file context>
@@ -722,6 +727,27 @@ private void mergePathItem(PathItem existing, PathItem incoming, String pathKey)
+ // WARN: keep the first (existing) operation, skip the incoming one.
+ return;
+ }
+ existing.addAdditionalOperation(method, operation);
+ });
+ }
</file context>
There was a problem hiding this comment.
Addressed in 19cf404. propagateRootSecurityToOperations iterates pathItem.readOperations(), which includes additionalOperations with the 3.2-capable parser. MergedSpecBuilderTest#shouldPropagateRootSecurityToAdditionalOperations covers it.
…erystring (httpx) Scope: httpx library only - raw TCP probes showed typhoeus up-cases custom verbs and crashes on non-alphanumeric tokens, and faraday rejects them, so both keep warning/skipping 3.2 operations. - arbitrary RFC 9110 method tokens are emitted as quoted Ruby symbols and reach the wire verbatim; HTTPX::Request internally stores @verb = verb.to_s.upcase, so non-standard verbs build the request via session.build_request and then restore @verb (HTTPX-internal dependency documented in the generated code) - invalid RFC 9110 tokens are warned about and skipped at codegen time - '#' is escaped inside the :"..." literal to avoid Ruby interpolation, '|' is escaped in generated markdown docs - in:querystring parameters are appended verbatim with automatic ?/& delimiter and excluded from the regular query_params hash - adds an executable raw TCP capture test (6 request lines verified) and unit tests for invalid-token skip, typhoeus skipping, and webhooks; samples regenerated (symbol quoting change is functionally equivalent) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
File.deleteOnExit() cannot remove non-empty directories, so generated output trees (and cargo target dirs) accumulated in /tmp. GoClientCodegenTest now collects temp dirs and deletes them recursively in @afterclass. isCommandAvailable() drained the child's stdout before waitFor(), which blocked forever when the spawned command waited on stdin (e.g. bare `ruby` with no arguments) - the timeout was never reached. Wait first, drain after. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…rystring (guzzle) Scope: guzzle library only - psr-18 delegates method handling to the injected PSR-17/PSR-18 implementation (Guzzle's factory up-cases, Symfony rejects non-uppercase tokens), and php-nextgen/php-dt are out of scope, so those keep warning/skipping 3.2 operations. - non-standard RFC 9110 methods build the request through an anonymous Request subclass that keeps the verbatim token: guzzlehttp/psr7 upper-cases in the constructor/withMethod, but Guzzle handlers only ever read RequestInterface::getMethod() - invalid RFC 9110 tokens are warned about and skipped at codegen time - "'" is escaped for PHP single-quoted literals, "|" for markdown docs - in:querystring parameters append verbatim with automatic ?/& delimiter and are excluded from the regular query params - adds an executable raw TCP capture test (composer install + php run, 6 request lines verified) and unit tests for psr-18 skipping, invalid tokens, and webhooks; all 15 php sample configs regenerate byte-identical Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…querystring (generichost)
Non-standard RFC 9110 method tokens are emitted as new HttpMethod("token")
instead of HttpMethod.Xxx, which does not exist for e.g. QUERY and whose
Normalize() would fold casing onto a standard method. Tokens that are not
valid tchar, or case-insensitively match a standard method (cannot be
preserved verbatim through HttpMethod), are warned about and skipped.
`in: querystring` parameters append verbatim to the request query after
UriBuilder and are excluded from ParseQueryString serialization.
AbstractCSharpCodegen.getOperationInputModels also scans
pathItem.getAdditionalOperations() so generichost webhooks get the same
treatment. restsharp/httpclient/unityWebRequest remain unsupported.
Adds a committed end-to-end test that builds the generated generichost
client and verifies six request lines via raw TcpListener capture;
dotnet restore failure or missing SDK skips, build/run failures fail.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…querystring (jvm-okhttp4) The shared RequestMethod enum is untouched (adding QUERY would break exhaustive when expressions in ktor/multiplatform templates). Instead the jvm-okhttp-shadowed RequestConfig carries customMethod/encodedQueryString: non-standard RFC 9110 tokens are emitted verbatim through okhttp's Request.Builder.method(String, ...) which preserves casing, and QUERY always gets a possibly-empty body since OkHttp 5 rejects bodyless QUERY. in:querystring params are excluded from the name=value query map and appended verbatim via encodedQuery. '$' is escaped for Kotlin string literals, '|' for markdown tables; non-tchar tokens warn+skip. Infra changes are gated on bundle flags so non-3.2 output is byte-identical; the other 7 kotlin libraries warn+skip. The committed test compiles the generated client with a PATH-detected kotlinc and captures raw request lines over a ServerSocket.
…te verbatim path to httpx - build_request now builds a body for non-standard methods too, so QUERY/additionalOperations with request bodies no longer drop them - build_request_url normalizes slashes on the path component only, so a querystring value containing '//' survives verbatim - isQueryStringParam is cleared for libraries other than httpx, so faraday/typhoeus fall back to normal name=value serialization instead of silently losing the parameter (fixed on both allParams and queryParams, which are independent copies) - fix debug logging in the httpx partial referencing undefined req_body (body_params is the local), which crashed debugging on 3.2 verbs - expand the shared 3.2 fixture with body-bearing QUERY, REPORT, PROPPATCH, a querystring param named 'uri', and a find op for unsupported-library fallback checks; extend the httpx wire capture to 9 cases incl. bodies and '//' preservation Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…2 ops - bump guzzle psr-7 constraint to ^2.10: 1.x could reconstruct the request and lose the verbatim-method anonymous subclass. This is a compatibility break for consumers pinned to psr-7 1.x - rename the internal \$uri variable to \$__requestUri so an 'in: querystring' parameter literally named 'uri' no longer collides - extend the guzzle wire capture for the uri-named param and body-bearing QUERY/REPORT/PROPPATCH cases Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…d case-variants - getOperationInputModels dropped its redundant additionalOperations traversal (PathItem.readOperations() already includes them) and now also traverses openAPI.getWebhooks(), so models referenced only by top-level webhooks get public ctors instead of internal - verified on real SDKs: net8 has no HttpMethod.Query and sends 'qUeRy' verbatim, net10 exposes HttpMethod.Query and normalizes 'qUeRy' to QUERY on the wire. Since generichost multi-targets, case-variants of normalized methods now warn+skip; uppercase QUERY stays verbatim via the literal path on both TFMs - wire capture extended to read request bodies and cover body-bearing QUERY/REPORT/PROPPATCH and the verbatim querystring-with-body case Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…or 3.2 verbs - toParamName now renames params named localVariableBody/ localVariableQuery/localVariableHeaders to param* (same pattern as the existing callback -> paramCallback escape), fixing compile-breaking collisions in generated api functions across all kotlin libraries - jvm-okhttp deepObject serialization now prefixes wire keys with the spec baseName (via x-kotlin-param-base-name) instead of paramName, so the rename no longer leaks into query keys - body-required custom methods handled as OkHttp 5's requiresRequestBody set (QUERY/REPORT/PROPPATCH) instead of QUERY alone, so REPORT and PROPPATCH no longer throw 'must have a request body' - fixture gains a /collide op with the three colliding query-param names plus a kotlin-only deepObject collision spec (shared fixture stays scalar-only: rust reqwest cannot serialize deepObject params) - wire capture extended to read bodies and cover REPORT/PROPPATCH, a body-bearing QUERY, and the collision op Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
A spec parameter named e.g. `query`, `headers`, `multipart`, `operationHost`, `hostIndex`, `returnType` or `options` landed in the same scope as the internal locals the generated api functions declare, silently dropping the caller's value (or producing duplicate declarations / array-to-string errors). Renaming only the `$uri` accumulator was a symptom-level patch. toParamName now compares the normalized parameter name against the full set of function-scope internal names in php/api.mustache (signature internals, xxxRequest locals, sync/async wrapper locals, $__requestUri, and the illegal `$this`) and prefixes colliding parameters with `param_`, keeping the wire baseName unchanged. Verified with a raw-TCP wire capture for required and optional/null `query`, `headers`, `multipart`, `uri` querystring params and a `headers` body param: the caller's value reaches the wire in every case.
…isions propagateParamBaseNameToVars wrote x-kotlin-param-base-name onto CodegenProperty instances that come from DefaultCodegen.fromProperty()'s cache, so two deepObject parameters sharing a model/property overwrote each other's wire-key prefix. Vars are now cloned before the parameter-local extension is attached; verified with a two-parameter fixture sharing the same property — each wire key keeps its own baseName. The collision guard in toParamName compared raw spec names, so variants like local_variable_body or LocalVariableBody normalized to the same localVariableBody/localVariableQuery/localVariableHeaders identifiers but slipped past the check and collided with template locals at codegen time. The guard now compares the normalized identifier; a /variants fixture exercises the spelling variants.
Eight of the nine temp-directory sites still used File.deleteOnExit, which cannot remove non-empty directories and left generated output behind on every run. Wrap them in try/finally + FileUtils.deleteDirectory like the wire-level test already does.
fromRequestBodyToFormParameters compared each allOf member's required entries against the normalized paramName, so any property whose paramName differs from its schema name (snake_case -> camelCase, or a collision rename) silently lost its required flag. A top-level required list also bypassed the allOf-member lists entirely. allRequired already unions the top-level and allOf-member required lists; compare it against the schema property name and also honor a single-allOf wrapper's own required list.
A form field `param_query` plus a query param `query` (renamed to `param_query` by the internal-variable collision guard) already resolves to distinct names under prependFormOrBodyParameters=true — the parameters-loop uniqueness pass sees the prepended form params in allParams. Add a fixture and assertion so a future regression cannot silently reintroduce a duplicate signature.
…c parameters
Spec parameters named after generated operation locals (body, query,
headers, ...) or api members (basePath, vertx, request, ...) previously
collided with or shadowed them in the generated Kotlin source, producing
uncompilable or miswired clients.
- AbstractKotlinCodegen.toParamName: treat any normalized name starting
with `localVar` as reserved (covers both the localVar* and
localVariable* template-local families) and rename such parameters
with a `param` prefix; wire names are preserved.
- Operation templates: prefix every generated statement-level local with
`localVariable` across jvm-okhttp, jvm-vertx, jvm-volley,
jvm-spring-restclient and jvm-spring-webclient.
- Qualify api-member references with `this.` so same-named parameters
cannot shadow them (vertx auth/vertx/basePath/handleResponse/
responseBody/encodeURIComponent/parseDateToQueryString, volley
requestFactory/postProcessors/requestQueue/basePath, spring request()).
- jvm-okhttp: use a labeled `this@{{classname}}.` receiver for member
calls made inside `apply {}` blocks, where plain `this` would bind to
the map receiver.
- jvm-spring-*: parseDateToQueryString is a top-level helper, so call it
package-qualified (`{{packageName}}.infrastructure.`) instead of
`this.`-qualified.
- Add a template lint test enforcing the localVar prefix on all
operation-scope val/var declarations (mustache tags stripped, partials
included) and a cross-library canary spec + test asserting param
renames, preserved wire names and member qualifications.
- pom.xml: move the okhttp5/moshi jars used by the generated-client
capture test out of the shared test classpath into a copied dependency
dir; okhttp5's Kotlin 2.x metadata broke the embedded Kotlin 1.6 test
compiler used by KotlinTestUtils.
- Regenerate all kotlin samples.
Generated jvm-vertx, jvm-spring-restclient, jvm-spring-webclient and
jvm-okhttp4 outputs verified to compile with kotlinc against real
dependency jars.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The api_client.rb changes for verbatim bodies on 3.2 verbs and path-only slash collapsing (51fa9b9), and the psr-7 ^2.10 bump plus param_* collision renames (62a98c2, 9f2676e), were committed without regenerating the samples. Backfill the drift so the committed samples match current templates. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
bc20a2c regressed a case the old code avoided by accident: for a form schema carrying both `properties`/`required` and oneOf/anyOf branches, ModelUtils.isOneOf/isAnyOf returns false (they require empty properties), so every property fell into the allOf-required path — and because addProperties unions the required lists of oneOf/anyOf alternatives too, branch-only fields were wrongly forced required. Keep collecting properties via addProperties but compute the effective required set with a dedicated traversal that only follows the schema's own required list and the allOf chain (resolving $ref, and starting from the pre-unwrap schema so a single-allOf wrapper's own required is covered). oneOf/anyOf branch requireds no longer force form fields. Note for users: this intentionally changes generated form-parameter signatures — fields required only inside a oneOf/anyOf alternative are now optional, matching the schema semantics. Specs where a renamed parameter (snake_case, collision) is required via allOf keep the fix from bc20a2c and stay required. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ate-call qualification
Follow-up fixes for the member-collision work:
- jvm-ktor and multiplatform emitted bare calls to the inherited
request()/jsonRequest()/urlEncodedFormRequest()/multipartFormRequest()
ApiClient members, so a spec parameter named `request` (or matching a
member) shadowed the call. Qualify them with `this.`.
- jvm-vertx rebound member names in `?.let { accessToken ->` lambda
bindings; rename the bindings to the localVariable prefix so a bare
member name is always a real violation.
- jvm-spring-restclient/webclient: revert the package-qualified
{{packageName}}.infrastructure.parseDateToQueryString() back to a bare
call. Kotlin resolves a call site to the function even when a value
parameter shares its name, and a package-qualified call breaks when a
parameter is named `org` (first segment of the default package).
Regression params `parseDateToQueryString` and `org` added to the
kotlin-member-collision fixture; generated spring clients compile.
- Add a lint test that mechanically extracts val/var member names from
each library's ApiClient constructor (volley: its own class header)
and fails on any bare `name` occurrence inside api.mustache's
{{#operation}} block or the operation partials, unless this./this@
qualified. Verified by mutation: a bare `basePath` reference fails.
- Assert ktor/multiplatform emit this.request/this.jsonRequest/
this.urlEncodedFormRequest alongside the spec `request` parameter.
- Copy spring/reactor jars into target/kotlin-capture-deps so the
generated spring clients can be compiled by the external kotlinc
without adding 2.x-metadata jars to the shared test classpath.
- Correct the collision-guard comment in AbstractKotlinCodegen.
Regenerate kotlin samples (bare spring calls restored; this.request()
emitted by ktor/multiplatform; localVariable* let-bindings in vertx).
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Wire names containing `$` (OData-style `$filter`/`$top`) were emitted unescaped inside Kotlin string literals in every library except jvm-okhttp. Kotlin string interpolation then turned the wire key into the same-named parameter's value — or failed compilation outright when no such variable was in scope (`"$top"`). Wrap every baseName/keyParamName/x-kotlin-param-base-name that renders inside a Kotlin string literal with the existing escapeDollar mustache lambda in the jvm-vertx, jvm-ktor, multiplatform, jvm-spring-restclient, jvm-spring-webclient, jvm-volley and jvm-retrofit2 templates (74 sites across 12 files), matching what jvm-okhttp already did. Add kotlin-dollar-wire-name.yaml (params `$filter`/`$top` plus a same-stem `filter` param) and a per-library regression test asserting the escaped literal is emitted; the jvm-vertx generated client compiles cleanly under kotlinc. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…alue
`.map(block: T.() -> V)` is a receiver lambda, so `.map { value }`
normally resolves to the wrapper's `value` field. But a spec parameter
named `value` shadows it and the lambda returns the caller's argument
instead of the decoded response (or fails to compile when types
diverge). Emit `this.value` so the receiver member is unambiguous.
Fixture kotlin-receiver-value.yaml exercises array and map responses
with a `value` query param; generated commonMain sources compile under
kotlinc.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Regression coverage requested after independently reviewing 7ab9da5 (collectRequiredFromAllOfChain, fixing OpenAPITools#16's original P1: oneOf branch-only fields incorrectly forced required when mixed with a top-level required list). No production code change -- the fix itself was already verified correct; these tests just pin it against six edge cases the original fix's own tests didn't cover: - 3-level allOf $ref chain: required collected from every level - oneOf nested inside an allOf member: branch-only fields (x, y) stay optional, the member's own field (c) becomes required - circular allOf $refs (CycA allOf[CycB], CycB allOf[CycA]): no StackOverflow, both sides' fields end up required - snake_case property names reaching required through an allOf $ref chain, matched by baseName - a composed (allOf) property nested inside another schema: its own inner `required` does not leak out to the outer schema's fields - anyOf branches mixed with top-level properties+required: the top-level field is required, the anyOf-only branch fields are not Self-review caught that the "no leak" case was a placebo as first written -- with no top-level property sharing the leaked field's name, a regression couldn't have failed the assertion either way. Added an optional top-level property with that name so a future regression actually flips it to required and fails the test. Verified: DefaultCodegenTest 184/184 pass (178 existing + 6 new). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n FILTER normalizer normalizePaths() built one methodMap combining the 9 fixed HTTP methods with additionalOperations entries, keyed by method.toLowerCase(). An additionalOperations key differing from a fixed method only by case (e.g. "GET" alongside the fixed `get:` field) silently overwrote that fixed method's entry once lowercased, so the FILTER normalizer rule (--openapi-normalizer FILTER=...) never evaluated the fixed operation at all -- it was missing from x-internal marking entirely. Only reachable with --skip-validate-spec (default validateSpec=true already rejects this shape via swagger-parser's own "duplicates a fixed Path Item method name" warning). methodMap goes back to the original immutable 9-entry Map.of(); additionalOperations are no longer merged into it. Filter gained a new single-operation apply(path, operation, method) overload (the existing public apply(path, PathItem, methodMap) now delegates to it per entry, so existing custom Filter subclasses keep compiling against the same signature); normalizePaths calls it once per additionalOperations entry directly, so a same-named fixed method and additionalOperations entry are both evaluated independently -- no shared map slot to collide over. New regression test testFilterWithCaseCollidingAdditionalOperation builds a PathItem with a fixed getGet() and an additionalOperations "GET" entry and checks both filter directions (operationId filter targeting only the additionalOperations one; method:get filter matching both). Confirmed the bug reproduces first: running the new test against the pre-fix code throws NPE (the fixed operation's getExtensions() was never reached). Verified: OpenAPINormalizerTest 72/72 pass. DefaultCodegenTest + ExclusiveMinMaxTest 198/198 pass. cpp-boost-beast's 5 test classes (the only other OpenAPINormalizer subclass consumer) 62/62 pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Brings the branch up to date with upstream (dda8e0e..ea65d43). Resolved 4 real conflicts, all independently reviewed by Fable before resolving: - JavaClientCodegenTest.java, PythonClientCodegenTest.java, RubyClientCodegenTest.java: both sides appended unrelated new test methods at the same insertion point (end of class). Kept both sets; no content was dropped (confirmed: zero removed lines vs. either parent). - kotlin-client/libraries/jvm-okhttp/api.mustache: upstream added a second `{{#queryParams}}` loop for `x-kotlin-explode-form-object` (Map-typed query params exploded to one key-value pair per entry), closing the first loop rather than appending inside it. Restructured to two sequential loops -- the branch's existing per-param serialization (now also gated on `{{^vendorExtensions.x-kotlin-explode-form-object}}` for clarity) followed by upstream's explode loop, matching the parameter-then-explode ordering upstream's own test asserts. `isQueryStringParam` (in:querystring, always a plain string) and `x-kotlin-explode-form-object` (Map-typed, explode=true) are mutually exclusive by construction (DefaultCodegen.fromParameter forces StringSchema for in:querystring; the explode flag requires isMap) -- confirmed by reading both code paths, not assumed. Upstream's explode block used `val values`/`val name` and an unqualified `parameterToString(it)`, which would have failed this branch's own lint test (testKotlinApiTemplatesUseLocalVariablePrefix, added in 94aca3a) and broken its `this@{{classname}}.` qualification convention. Renamed to `localVariableValues`/ `localVariableName` and qualified the call; updated upstream's own test assertions (KotlinClientCodegenApiTest) to match the renamed locals. Verified (Devin implemented per a self-contained spec reviewed by Fable; independently re-run here): JavaClientCodegenTest 300/300, PythonClientCodegenTest 97/97, RubyClientCodegenTest 36/36 (1 env-skip), KotlinClientCodegenApiTest 47/47, RustClientCodegenTest 24/24 (1 env-skip), TypeScriptFetchClientCodegenTest 54/54 -- all pass. The 7 toolchain-dependent tests skipped without dev-env in PATH were individually re-run with kotlinc/ruby+httpx/cargo available and all pass. Samples regenerated across all 199 kotlin/ruby/go/python/ typescript-fetch configs (./bin/generate-samples.sh); diff limited to 2 files (python-httpx2, python-httpx2-sync -- new upstream samples the in:querystring fix correctly reached). No leftover conflict markers (git grep across *.java/*.mustache clean). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
….query()
K6ClientCodegen builds its HTTPRequest/HTTPRequestGroup data (the input
to script.mustache) through two of its own direct
PathItem.readOperationsMap() traversals, bypassing the
supportsAdditionalOperations() gate that DefaultGenerator/DefaultCodegen
use elsewhere to skip-and-warn on unsupported OpenAPI 3.2 operations (k6
doesn't override the capability, so it defaults to false). A path with a
`query` operation therefore still reached HTTPRequest.method =
"query", and script.mustache's `http.{{method}}(...)` emitted
`http.query(url)` -- even though DefaultGenerator's own warning for this
path claimed the operation "will be missing from the generated output".
k6's http module has no `query` function in any released version
(verified against v2.3.0, 2026-09-21, the latest release: only get/post/
put/patch/del/options/request are exported) -- the generated script
throws `TypeError: http.query is not a function` at runtage. (Note: k6's
unreleased master branch has since added a query export for the same
RFC 9110 HTTP QUERY method, but no shipped version has it yet.)
Both traversals now skip PathItem.HttpMethod.QUERY when
!supportsAdditionalOperations(), logging the same warning text
DefaultGenerator already uses elsewhere for consistency. Self-review
caught a derived bug: a path whose only operation was the skipped
`query` left `pathVariables.get(groupName)` returning null, which
produced an HTTPRequestGroup with a null `variables` field -- NPEs in
initializeDataExtractSubstituteParameters for specs with a sibling
dataextract operation, and an empty `group(...)` block left in script.js
for specs without one. Guarded against registering a group with zero
requests.
New K6ClientCodegenTest (no prior Java test existed for this generator):
testQueryOperationIsSkipped (get+query mixed path: http.get present,
http.query/searchItems absent) and a query-only path with a sibling
dataextract operation (no NPE, no empty group). Confirmed the bug
reproduces: running the new test against the pre-fix code (production
change stashed) fails with http.query(/searchItems detected in script.js.
Verified: K6ClientCodegenTest 2/2, DefaultGeneratorTest 27/27,
DefaultCodegenTest 187/187, OpenAPINormalizerTest 72/72,
InlineModelResolverTest 63/63 pass. generate-samples.sh on the 3 k6
configs: zero diff (existing k6 samples unaffected).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Conflicts resolved by keeping both sides: - CodegenParameter: isQueryStringParam (3.2 querystring) alongside upstream's headerIsJsonMimeType in fields, copy(), hashCode() - PythonClientCodegen: upstream's JSON-header flag runs before the super call; OpenAPI 3.2 operation flagging runs after it - TypeScriptFetchClientCodegen: git auto-merged two separate postProcessWebhooksWithModels overrides (compile error); folded into one that flags 3.2 operations, then applies upstream's JSON-header import fix-up Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream added these samples after the previous merge; regenerating with this branch's Go querystring handling and TypeScript HTTPMethod widening brings them in line so "Samples up-to-date" stays clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hooks after import fix-up - ExtendedCodegenParameter copied isDeepObject/isMatrix/isAllowEmptyValue/ isFormStyle/isSpaceDelimited/isPipeDelimited twice once upstream added the same assignments; keep upstream's. - postProcessWebhooksWithModels: run upstream's JSON-header import fix-up before flagOpenAPI32Operations, so removing an operation with an invalid method token cannot leave apis.mustache emitting a model import without its className/classFileName. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi, thanks for your work on this! Since PR #24969 has been merged, I was wondering if there were any updates on this PR. |
OpenAPITools#24969 was squash-merged into master and conflicts with this branch's own copy of the same change. This branch's versions are kept for all four files because they are a superset of what master received: - CodegenConfigurator / CodegenConfiguratorTest: keep the follow-up review fixes (dots allowed in custom method tokens, thread-scoped log capture) that were made here after OpenAPITools#24969's content was copied in. - issue_24212_unsupported_version.yaml: keep `openapi: 4.0.0`; with the 3.2-capable parser this branch depends on, 3.2.0 is no longer an unsupported version. - pom.xml: keep swagger-parser 2.1.49-SNAPSHOT (master moved 2.1.47 -> 2.1.48); the OpenAPI 3.2 model/parser support is not in any release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- DefaultGeneratorTest: assert additionalOperations HTTP methods by operationId lookup instead of list index order - RustClientCodegenTest: assert RFC 9110 invalid-method WARN log on the current thread and gate cargo e2e test behind -Drust.e2e=true - JavaClientCodegenTest: call validateJavaSourceFiles(files) in the three OpenAPI 3.2 / dynamicOperations tests Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Hi @ray-cha, thanks for following up, and sorry for the slow reply! Now that #24969 is merged, I'm updating this branch to resolve the overlap with master and to address the remaining cubic-dev-ai review comments. This PR is still a draft because it depends on OpenAPI 3.2 support in swagger-core / swagger-parser that hasn't been released yet (swagger-api/swagger-core#5326, swagger-api/swagger-parser#2401 and #2402). The published swagger-parser 2.1.49-SNAPSHOT doesn't include those changes, so this branch can't be built outside my machine yet; my fork's CI fails at dependency resolution for that reason. I'll mark this PR ready for review as soon as those upstream PRs land. |
# Conflicts: # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
|
@ray-cha a quick update: I merged the latest master into this branch. There were two conflicts: one overlapped with #25346 in It's still a draft because it depends on unreleased changes (swagger-api/swagger-core#5326, swagger-api/swagger-parser#2401 and #2402), so CI here can't resolve them yet. I'm also looking into whether the 3.2 constructs could be handled inside openapi-generator with the released parser, so this doesn't have to wait on those; I'll follow up here if that turns out to be workable. |
…ames verbatim
The okhttp-gson api template rendered {{httpMethod}} through Mustache's
HTML escaper, so a custom method like CHECK&FETCH became "CHECK&FETCH"
in generated code. Use {{{httpMethod}}} instead - additionalOperations
keys are RFC 9110 tchar (no '"' or '\\'), so the verbatim token is always
a valid Java string literal.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…t are not RFC 9110 tokens okhttp-gson emits the HTTP method verbatim as a Java string literal, so keys containing '"' or other non-tchar characters generated uncompilable code. Warn and skip such operations, matching the go/python behavior. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…master Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Putting new tests at the end of a file tends to conflict with other PRs that do the same. No test content changes. - config/MergedSpecBuilderTest.java - csharpnetcore/CSharpClientCodegenTest.java - go/GoClientCodegenTest.java - kotlin/KotlinClientCodegenApiTest.java - php/PhpClientCodegenTest.java - typescript/fetch/TypeScriptFetchClientCodegenTest.java Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The following fixes were extracted into separate PRs and no longer belong here; revert them to upstream/master so that this PR now only carries the OpenAPI 3.2 changes. | fix | what | original commits | split-out PR | |-----|------|------------------|--------------| | A1 | kotlin jvm-vertx form sending | parts of 75be8f4, 7f1bcb8 | OpenAPITools#25623 | | A2 | kotlin ktor/multiplatform form `it` | parts of 07530ab, 3a953e5, f1575f3, 7f1bcb8 | OpenAPITools#25624 | | A3 | kotlin `$` escaping | parts of 9074531, 7f1bcb8 | OpenAPITools#25625 | | A4 | kotlin member reads via `this.` | 94aca3a, 19694ac (main part) | OpenAPITools#25691, OpenAPITools#25692 | | A5 | kotlin param/generated-local collisions | rename part of 6b82674 | OpenAPITools#25690 | | A6 | kotlin deepObject keys | 910b590 | OpenAPITools#25622 | | A7 | core form required (allOf) | 7ab9da5, bc20a2c | OpenAPITools#25627 | | A8 | php internal-variable collisions | 9f2676e, a00d51c (keeping the 3.2 capture/fixture parts) | OpenAPITools#25630 | | A9 | csharp webhook input models | webhook-scan part of e49e09e | OpenAPITools#25626 | | A10 | core unexpected-attribute regex | widen part of e5ec5f4 | OpenAPITools#25621 | This PR now only carries the OpenAPI 3.2 changes. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…name (A5)
The `put("localVariableQuery", listOf(paramLocalVariableQuery.toString()))`
assertion was emitted by the /collide operation's `in: query` parameters,
which were removed together with the A5 fix (split out to OpenAPITools#25690). The
remaining `in: querystring` rename assertion still holds.
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved:
- pom.xml: took upstream's swagger-parser.version 2.1.49 (the 3.2 SNAPSHOT
switch is handled separately via -Pswagger-fork).
- DefaultGenerator.java: kept upstream's shared processPathItems for paths
and webhooks, carrying this branch's 3.2 query/additionalOperations
handling; dropped the now-duplicate branch-side processWebhooks; kept the
hasQueryOrAdditionalOperations/hasQueryStringParameter helpers and the
wireHttpMethod processOperation overload.
- JavaClientCodegen.java: kept both changes — the 3.2 skipNonTokenHttpMethods
block and upstream's added isLibrary(OKHTTP) in the
singleRequestParameter condition.
- typescript-fetch/apis.mustache: kept both guards — {{^isQueryStringParam}}
wraps each query param, with upstream's {{#queryIsJsonMimeType}} JSON
serialization branch inside.
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…agger forks Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PITools#25690 Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Status: Draft — needs swagger-core / swagger-parser builds with OAS 3.2 support
This PR is not ready to merge. It builds on #24969 (already merged), and
needs OAS 3.2 model and parsing support that is not in a released
swagger-core / swagger-parser yet (swagger-api/swagger-core#5326,
swagger-api/swagger-parser#2401, #2402).
To build it before those are released, the root
pom.xmlhas aswagger-forkprofile. Build swagger-core and swagger-parser from theoas32-integrationbranches of khayashi4337/swagger-core andkhayashi4337/swagger-parser (versions
2.2.56-oas32.1and2.1.49-oas32.1), put them in a Maven repository, and run:The default build uses the released swagger-parser and does not compile on
this branch yet. Once swagger-core / swagger-parser release OAS 3.2
support, I will switch to the released versions and drop the profile.
What this adds (on top of #24969)
Generates code for the OAS 3.2 constructs that the swagger-parser fork now
parses into the model: the
queryHTTP method,additionalOperations(arbitrary-named path-item operations), and
in: querystringparameters.Scope: the cross-language core path (so
query/additionalOperationsare picked up structurally everywhere), plus nine generator/library
combinations wired up end-to-end and verified on the wire:
Generators that have not opted in warn and skip 3.2 operations instead of
emitting non-compiling references to HTTP-method enum constants that don't
exist for their target language.
additionalOperationskeys are sent as wire HTTP method names verbatim(a new
wireHttpMethodpath bypasses the existing uppercase-normalizationthat's correct for the 8 fixed methods but wrong for arbitrary ones)
in: querystringbecomesCodegenParameter.isQueryStringParam, typed asa plain string via the target language's own type mapping (content-derived
model import/
setContentis skipped for it)supportsAdditionalOperations()/supportsQueryStringParameters()per-library with a concrete reason —e.g. Python: aiohttp/httpx call
method.upper()and would corruptcustomMethodintoCUSTOMMETHOD; Ruby: typhoeus crashes onnon-alphanumeric tokens and faraday rejects them; C#: restsharp's Method
enum rejects non-standard tokens; Kotlin: only jvm-okhttp4's shadow
request config can carry custom methods.
supportsAdditionalOperations()hook (defaultfalse, mirroring theexisting
supportsQueryStringParameters()hook) makes generators thathaven't opted in warn-and-skip rather than silently emit references to
HTTP-method enum constants (
PURGE,QUERY, ...) that don't exist fortheir target language — this was a real gap caught during review: the
shared pipeline originally let these values reach every language's
templates, and 15+ non-Java templates (Spring, Kotlin, TypeScript, ...)
would have produced non-compiling output for a 3.2 spec with no warning at
all.
Fixes that used to be in this branch
The fixes below are not specific to OAS 3.2. They are now separate PRs and
have been removed from this branch, so this PR only carries the OAS 3.2
changes:
it$in wire namesthis.Known limitations (disclosed, not blocking this draft)
Only the nine generator/library combinations above emit 3.2 operations;
every other library (including the other Kotlin libraries, Java's
non-okhttp-gson libraries, and the non-fetch TypeScript generators)
warns and skips.
At least one generator (
k6) builds its supporting script from its ownindependent traversal of the model rather than going through the shared,
now-gated pipeline, so it isn't covered by the new
supportsAdditionalOperations()guard. A handful of other generators usea similar direct-traversal pattern and haven't been individually audited.
None of this is new — it follows from swagger-core's
PathItem.HttpMethodenum gaining a
QUERYvalue, which any code iterating that enum directlywill now see, independent of anything in this PR.
MergedSpecBuilder(multi-spec merge) now includesadditionalOperationsin its merge and operation-ID conflict detection.
OpenApiEvaluatorstill assumes the fixedHttpMethodenum and doesn'tsupport arbitrary
additionalOperations.PHP: an
in: querystringparameter named like one of the generatedmethod's internal variables (for example
queryorheaders) is stilloverwritten by that variable. fix(php): rename spec parameters only where they collide with generated local variables #25630 fixes this for all parameters; this
PR relies on it.
PHP:
composer.jsonnow requiresguzzlehttp/psr7^2.10 || ^3.0(was
^1.7 || ^2.0 || ^3.0). psr7 1.x can rebuild the request and losethe subclass that sends the OAS 3.2 method name verbatim. This affects
every PHP client, so it is a compatibility change for users pinned to
psr7 1.x.
Testing
Built with
-Pswagger-forkagainst swagger-core2.2.56-oas32.1and swagger-parser2.1.49-oas32.1(theoas32-integrationbranches), on the current master merged into this branch:modules/openapi-generatortests: 281 classes, 5984 tests, 0 failures, 0 errors, 18 skipped (in KotlinModelCodegenTest, N8nClientCodegenTest, PhpSymfonyServerCodegenTest, PhpClientCodegenTest, RustClientCodegenTest, KotlinClientCodegenApiTest, RubyClientCodegenTest, CSharpClientCodegenTest and TypeScriptFetchClientCodegenTest).kotlin-*andcsharp-*configs (222 configs); no diff.The wire-level checks that compile a generated client and capture the raw HTTP request are kept for C# (generichost), Kotlin (okhttp), PHP (guzzle), Ruby (httpx) and Rust (reqwest) (
src/test/resources/3_2/*-capture). I did not check on this run which of them were among the skipped tests.🤖 Generated with Claude Code
Summary by cubic
Generates code for OpenAPI 3.2's
queryHTTP method,additionalOperationsmap, andin: querystringparameters through the shared pipeline and nine generator/library combinations (Java okhttp-gson, Go, Python urllib3, typescript-fetch, Rust reqwest, Ruby httpx, PHP guzzle, C# generichost, Kotlin jvm-okhttp4). Also fixes issue #24212: with--skip-validate-spec, unrecognized path-item operations now produce an explicit warning naming the dropped member instead of being silently dropped.The branch stays unmergeable: it pins
swagger-parser2.1.49-SNAPSHOT because the OAS 3.2 model/parser classes aren't in any released version, so CI (including theRequireReleaseDepsenforcer rule) cannot pass until upstream cuts a release.Behavior changes
additionalOperationskeys are sent verbatim as the wire HTTP method name; invalid RFC 9110 tokens and case-variants some clients would normalize are warned and skipped.in: querystringparameters becomeCodegenParameter.isQueryStringParamand append their already-encoded value verbatim to the request path, skipping content-derived model imports. Operations using them are skipped with a warning in generators without support instead of corrupting the value via name=value serialization.supportsAdditionalOperations()hook (defaultfalse) makes unsupported generators warn-and-skip instead of emitting references to HTTP-method enum constants that don't exist for their target language.OpenAPIobject, generation fails immediately with the parser's diagnostics instead of a generic downstream error.Additional fixes
k6skips 3.2queryoperations with a warning and no longer leaves empty request groups when a query-only path coexists with a siblingdataextractoperation.additionalOperationsentries independently, so a key likeGETalongside the fixedget:field can no longer overwrite the fixed method's entry.Written for commit 8559f07. Summary will update on new commits.